<div class="dux-page-header am-cf">
    <div class="page-title">
        <a class="am-btn am-btn-primary" href="{url('index')}"> 碎片列表</a>
    </div>
    <div class="page-action">
        <a class="am-btn am-btn-danger" href="javascript:location.reload();"><i class="am-icon-refresh"></i></a>
    </div>
</div>

<div class="dux-body">
    <div class="am-panel am-panel-default dux-panel">
        <div class="am-panel-hd">{$assignName}碎片</div>
        <div class="am-panel-bd">
            <form class="am-form  am-form-horizontal dux-form" data-mango="form-bind" method="post">
                <fieldset>
                    <div class="am-form-group">
                        <label class="am-u-md-2 am-u-sm-12 am-form-label">碎片描述</label>
                        <div class="am-u-md-10 am-u-sm-12">
                            <input type="text" name="title" value="{$info.title}" placeholder="请输入碎片描述" required>
                        </div>
                    </div>

                    <div class="am-form-group">
                        <label class="am-u-md-2 am-u-sm-12 am-form-label">编辑器</label>
                        <?php if(!isset($info['editor'])) $info[ 'editor']=1 ; ?>
                        <div class="am-u-md-10 am-u-sm-12">
                            <div class="am-g">
                                <label class="am-radio-inline">
                                    <!--if{$info['editor']}-->
                                    <input class="editor" name="editor" value="1" checked="checked" type="radio">
                                    <!--{else}-->
                                    <input class="editor" name="editor" value="1" type="radio">
                                    <!--{/if}-->
                                    使用
                                </label>

                                <label class="am-radio-inline">
                                    <!--if{!$info['editor']}-->
                                    <input class="editor" name="editor" checked="checked" value="0" type="radio">
                                    <!--{else}-->
                                    <input class="editor" name="editor" value="0" type="radio">
                                    <!--{/if}-->
                                    不使用
                                </label></div>
                        </div>
                    </div>

                    <div class="am-form-group">
                        <label class="am-u-md-2 am-u-sm-12 am-form-label">碎片内容</label>
                        <div class="am-u-md-10 am-u-sm-12">
                            <textarea data-mango="form-editor" id="content" name="content" style="height: 300px"
                            <!--if{!$info['editor']}-->
                                      data-load="false"
                            <!--{/if}-->
                            >{$info.content}</textarea>
                        </div>
                    </div>
                    <div class="am-form-group">
                        <div class="am-u-sm-offset-12 am-u-md-offset-2">
                            <input type="hidden" name="fragment_id" value="{$info.fragment_id}">
                            <button class="am-btn am-btn-primary" type="submit" disabled>保存</button>
                        </div>
                    </div>

                </fieldset>
            </form>
        </div>
    </div>
</div>
<script>
    Do('base', function() {
        $('.editor').on('click', function() {
            editor($(this).val());
        });
        var editor = function(status) {
            if(status == 1) {
                window['contentEditor'].undestroy();
            }else {
                window['contentEditor'].destroy();
            }
        };


    });
</script>